/*
 * @Author: Kang
 * @Date: 2022-02-20 08:43:16
 * @Last Modified by: Kang
 * @LastEditTime: 2022-02-22 17:47:51
 */
module.exports = app => {
    class VerifController extends app.Controller {
        * verification() {
            const { ctx, app } = this
            try {
                const res = yield this.service.verif.getMsgCode(ctx.query,'REG_CODE');
                const result = {
                    status: 200,
                    data: res,
                    msg: '发送成功',
                }
                ctx.body = result;
            } catch (error) {
                const result = {
                    status: 500,
                    data: null,
                    msg: '发送失败，请稍后重试！',
                }
                ctx.body = result;
            }
        }

        * create() {
            const { ctx, app } = this
            try {
                const result = yield this.service.verif.create(ctx.request.body)
                ctx.body = result;
            } catch (error) {
                const result = {
                    status: 500,
                    data: error,
                    msg: '添加失败，请稍后重试！',
                }
                ctx.body = result;
            }
        }
    }
    return VerifController;
}